'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 1999 Sun Microsystems, Inc.  All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH RUNACCT 8 "May 11, 1999"
.SH NAME
runacct \- run daily accounting
.SH SYNOPSIS
.LP
.nf
\fB/usr/lib/acct/runacct\fR [\fImmdd\fR [\fIstate\fR]]
.fi

.SH DESCRIPTION
.sp
.LP
\fBrunacct\fR is the main daily accounting shell procedure. It is normally
initiated using  \fBcron\fR. \fBrunacct\fR processes connect, fee, disk, and
process accounting files. It also prepares summary files for \fBprdaily\fR or
billing purposes. \fBrunacct\fR is distributed only to source code licensees.
.sp
.LP
\fBrunacct\fR takes care not to damage active accounting files or summary files
in the event of errors. It records its progress by writing descriptive
diagnostic messages into \fBactive\fR. When an error is detected, a message is
written to \fB/dev/console\fR, mail (see \fBmail\fR(1)) is sent to \fBroot\fR
and \fBadm\fR, and \fBrunacct\fR terminates. \fBrunacct\fR uses a series of
lock files to protect against re-invocation. The files \fBlock\fR and
\fBlock1\fR are used to prevent simultaneous invocation, and \fBlastdate\fR is
used to prevent more than one invocation per day.
.sp
.LP
\fBrunacct\fR breaks its processing into separate, restartable \fIstates\fR
using \fBstatefile\fR to remember the last \fIstate\fR completed. It
accomplishes this by writing the \fIstate\fR name into \fBstatefile\fR.
\fBrunacct\fR then looks in \fBstatefile\fR to see what it has done and to
determine what to process next. \fIstates\fR are executed in the following
order:
.sp
.ne 2
.na
\fB\fBSETUP\fR\fR
.ad
.RS 14n
Move active accounting files into working files.
.RE

.sp
.ne 2
.na
\fB\fBWTMPFIX\fR\fR
.ad
.RS 14n
Verify integrity of \fBwtmpx\fR file, correcting date changes if necessary.
.RE

.sp
.ne 2
.na
\fB\fBCONNECT\fR\fR
.ad
.RS 14n
Produce connect session records in \fBtacct.h\fR format.
.RE

.sp
.ne 2
.na
\fB\fBPROCESS\fR\fR
.ad
.RS 14n
Convert process accounting records into \fBtacct.h\fR format.
.RE

.sp
.ne 2
.na
\fB\fBMERGE\fR\fR
.ad
.RS 14n
Merge the connect and process accounting records.
.RE

.sp
.ne 2
.na
\fB\fBFEES\fR\fR
.ad
.RS 14n
Convert output of \fBchargefee\fR into \fBtacct.h\fR format, merge with
connect, and process accounting records.
.RE

.sp
.ne 2
.na
\fB\fBDISK\fR\fR
.ad
.RS 14n
Merge disk accounting records with connect, process, and fee accounting
records.
.RE

.sp
.ne 2
.na
\fB\fBMERGETACCT\fR\fR
.ad
.RS 14n
Merge the daily total accounting records in \fBdaytacct\fR with the summary
total accounting records in \fB/var/adm/acct/sum/tacct\fR.
.RE

.sp
.ne 2
.na
\fB\fBCMS\fR\fR
.ad
.RS 14n
Produce command summaries.
.RE

.sp
.ne 2
.na
\fB\fBUSEREXIT\fR\fR
.ad
.RS 14n
Any installation dependent accounting programs can be included here.
.RE

.sp
.ne 2
.na
\fB\fBCLEANUP\fR\fR
.ad
.RS 14n
Clean up temporary files and exit. To restart \fBrunacct\fR after a failure,
first check the \fBactive\fR file for diagnostics, then fix any corrupted data
files, such as \fBpacct\fR or \fBwtmpx\fR. The \fBlock\fR, \fBlock1\fR, and
\fBlastdate\fR files must be removed  before \fBrunacct\fR can be restarted.
The argument \fImmdd\fR is necessary if \fBrunacct\fR is being restarted.
\fImmdd\fR specifies the month and day for which \fBrunacct\fR will rerun the
accounting. The entry point for processing is based on the contents of \fB
statefile\fR; to override this, include the desired \fIstate\fR on the command
line to designate where processing should begin.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRStarting \fBrunacct\fR
.sp
.LP
The following example starts \fBrunacct\fR:

.sp
.in +2
.nf
example% nohup runacct 2> /var/adm/acct/nite/fd2log &
.fi
.in -2
.sp

.LP
\fBExample 2 \fRRestarting \fBrunacct\fR
.sp
.LP
The following example restarts \fBrunacct\fR:

.sp
.in +2
.nf
example% nohup runacct 0601 2>> /var/adm/acct/nite/fd2log &
.fi
.in -2
.sp

.LP
\fBExample 3 \fRRestarting \fBrunacct\fR at a Specific State
.sp
.LP
The following example restarts \fBrunacct\fR at a specific state:

.sp
.in +2
.nf
example% nohup runacct 0601 MERGE 2>> /var/adm/acct/nite/fd2log &
.fi
.in -2
.sp

.SH FILES
.sp
.ne 2
.na
\fB\fB/var/adm/wtmpx\fR\fR
.ad
.sp .6
.RS 4n
History of user access and administration information
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/pacct\fR\fIincr\fR\fR
.ad
.sp .6
.RS 4n

.RE

.sp
.ne 2
.na
\fB\fB/var/adm/acct/nite/active\fR\fR
.ad
.sp .6
.RS 4n

.RE

.sp
.ne 2
.na
\fB\fB/var/adm/acct/nite/daytacct\fR\fR
.ad
.sp .6
.RS 4n

.RE

.sp
.ne 2
.na
\fB\fB/var/adm/acct/nite/lock\fR\fR
.ad
.sp .6
.RS 4n

.RE

.sp
.ne 2
.na
\fB\fB/var/adm/acct/nite/lock1\fR\fR
.ad
.sp .6
.RS 4n

.RE

.sp
.ne 2
.na
\fB\fB/var/adm/acct/nite/lastdate\fR\fR
.ad
.sp .6
.RS 4n

.RE

.sp
.ne 2
.na
\fB\fB/var/adm/acct/nite/statefile\fR\fR
.ad
.sp .6
.RS 4n

.RE

.SH SEE ALSO
.sp
.LP
.BR acctcom (1),
.BR mail (1),
.BR acct (2),
.BR acct.h (3HEAD),
.BR utmpx (5),
.BR attributes (7),
.BR acct (8),
.BR acctcms (8),
.BR acctcon (8),
.BR acctmerg (8),
.BR acctprc (8),
.BR acctsh (8),
.BR cron (8),
.BR fwtmp (8)
.SH NOTES
.sp
.LP
It is not recommended to restart \fBrunacct\fR in the \fBSETUP\fR \fIstate\fR.
Run \fBSETUP\fR manually and restart using:
.sp
.LP
\fBrunacct\fR \fImmdd\fR \fBWTMPFIX\fR
.sp
.LP
If \fBrunacct\fR failed in the \fBPROCESS\fR \fIstate,\fR remove the last
\fBptacct\fR file because it will not be complete.
.sp
.LP
The \fBrunacct\fR command can process a maximum of
.RS +4
.TP
.ie t \(bu
.el o
6000 distinct sessions
.RE
.RS +4
.TP
.ie t \(bu
.el o
1000 distinct terminal lines
.RE
.RS +4
.TP
.ie t \(bu
.el o
2000 distinct login names
.RE
.sp
.LP
during a single invocation of the command.  If at some point the actual number
of any one of these items exceeds the maximum, the command will not succeed.
.sp
.LP
Do not invoke \fBrunacct\fR at the same time as \fBckpacct\fR, as there may be
a conflict if both scripts attempt to execute \fBturnacct switch\fR
simultaneously.
